<template>
  <div>
      <div id="main" style='width:500px;height:500px;'> </div>

  </div>
</template>

<script>
import * as echarts from 'echarts';

export default {
    data(){
        return{
            data1:[],
            data2:[],
            fund_code:this.$route.query.fund_code
        }
    },
    methods:{
        get_echarts(){
            var chartDom = document.getElementById('main');
            var myChart = echarts.init(chartDom);
            var option;

            option = {
            xAxis: {
                type: 'category',
                data: this.data2
            },
            yAxis: {
                type: 'value'
            },
            series: [
                {
                data: this.data1,
                type: 'line'
                }
            ]
            };

            option && myChart.setOption(option);
            },
            getlist(){
                this.myaxios('http://localhost:5000/myecharts?fund_code='+this.fund_code,'get').then(res=>{
                    console.log(res);
                    this.data1 = res.lst
                    this.data2 = res.lst1
                    this.get_echarts()
                    
                })
            }
    },
    mounted(){
        setInterval(this.getlist,2000)
        
        
    }
    
}
</script>

<style>

</style>